projects
/
project
/
netifd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
4b83102
)
interface: fix memory leak on error in __interface_add()
author
Hans Dedecker
<
[email protected]
>
Mon, 26 Nov 2018 08:24:02 +0000
(09:24 +0100)
committer
Hans Dedecker
<
[email protected]
>
Mon, 26 Nov 2018 08:26:42 +0000
(09:26 +0100)
Detected by Coverity in cid
1441495
Signed-off-by: Hans Dedecker <
[email protected]
>
interface.c
patch
|
blob
|
history
diff --git
a/interface.c
b/interface.c
index 4cefe6454dae6c8c94989e0065250661b64e26e1..44f7a874e3033044e2e199ce3a533ba72fce8f76 100644
(file)
--- a/
interface.c
+++ b/
interface.c
@@
-892,7
+892,7
@@
static bool __interface_add(struct interface *iface, struct blob_attr *config, b
{
struct blob_attr *tb[IFACE_ATTR_MAX];
struct blob_attr *cur;
- char *name =
iface->dynamic ? strdup(iface->name) :
NULL;
+ char *name = NULL;
blobmsg_parse(iface_attrs, IFACE_ATTR_MAX, tb,
blob_data(config), blob_len(config));
@@
-908,6
+908,13
@@
static bool __interface_add(struct interface *iface, struct blob_attr *config, b
iface->ifname = blobmsg_data(cur);
}
+ if (iface->dynamic) {
+ name = strdup(iface->name);
+
+ if (!name)
+ return false;
+ }
+
iface->config = config;
vlist_add(&interfaces, &iface->node, iface->name);